<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="__STATIC__/public/layui/css/layui.css"  media="all">
</head>
<body>
<img src="" alt="" id="qrcode">
<button id="start">111</button>

<script src="__STATIC__/public/layui/layui.js"></script>
<script src="__STATIC__/public/jquery/jquery.min.js"></script>
<script>
    layui.use(['layer', 'form'], function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
        $("#start").click(function () {
            $.ajax({
                url:"{:url('index/index/botStart')}",
                data:$('#admin').serialize(),
                type:'post',
                async: false,
                success:function(res) {
                    window.location.reload();
                    console.log(res.url);
                    if(res.code == 1) {
                        $("#qrcode").attr('src',res.url);

                    } else {
                        layer.msg(res.msg);
                    }
                }
            })
        });
       var aaa=setInterval(function () {
           $.ajax({
               url:"{:url('index/index/getUrl')}",
               data: $('#admin').serialize(),
               type: 'post',
               async: false,
               success: function (res) {
                   if (res.code == 1) {
                       layer.msg(res.msg);
                       console.log(res);
                       $("#qrcode").attr('src',res.data.url);
                       clearInterval(aaa);
                   } else {
                       layer.msg(res.msg);
                   }
               }
           })
       },1000)

    });
</script>
</body>
</html>